object FinanceDM: TFinanceDM
  OldCreateOrder = False
  OnCreate = DataModuleCreate
  OnDestroy = DataModuleDestroy
  Height = 402
  Width = 712
  object qryVoucher: TUniQuery
    SQLInsert.Strings = (
      'INSERT INTO tfb_voucher'
      
        '  (voucherid, bcode, bdate, bstate, bkind, create_by, signer_by,' +
        ' vouwordid, orderno, voucherno, update_time, formertype, formerb' +
        'id, formerbno, vouyearmonth, check_by, binder_by, filid, filorde' +
        'rno, carforproloss, affix, create_time, check_time)'
      'VALUES'
      
        '  (:voucherid, :bcode, :bdate, :bstate, :bkind, :create_by, :sig' +
        'ner_by, :vouwordid, :orderno, :voucherno, :update_time, :formert' +
        'ype, :formerbid, :formerbno, :vouyearmonth, :check_by, :binder_b' +
        'y, :filid, :filorderno, :carforproloss, :affix, :create_time, :c' +
        'heck_time)')
    SQLDelete.Strings = (
      'DELETE FROM tfb_voucher'
      'WHERE'
      '  voucherid = :Old_voucherid')
    SQLUpdate.Strings = (
      'UPDATE tfb_voucher'
      'SET'
      
        '  voucherid = :voucherid, bcode = :bcode, bdate = :bdate, bstate' +
        ' = :bstate, bkind = :bkind, create_by = :create_by, signer_by = ' +
        ':signer_by, vouwordid = :vouwordid, orderno = :orderno, vouchern' +
        'o = :voucherno, update_time = :update_time, formertype = :former' +
        'type, formerbid = :formerbid, formerbno = :formerbno, vouyearmon' +
        'th = :vouyearmonth, check_by = :check_by, binder_by = :binder_by' +
        ', filid = :filid, filorderno = :filorderno, carforproloss = :car' +
        'forproloss, affix = :affix, create_time = :create_time, check_ti' +
        'me = :check_time'
      'WHERE'
      '  voucherid = :Old_voucherid')
    SQLLock.Strings = (
      'SELECT * FROM tfb_voucher'
      'WITH (UPDLOCK, ROWLOCK, HOLDLOCK)'
      'WHERE'
      '  voucherid = :Old_voucherid')
    SQLRefresh.Strings = (
      
        'SELECT voucherid, bcode, bdate, bstate, bkind, create_by, signer' +
        '_by, vouwordid, orderno, voucherno, update_time, formertype, for' +
        'merbid, formerbno, vouyearmonth, check_by, binder_by, filid, fil' +
        'orderno, carforproloss, affix, create_time, check_time FROM tfb_' +
        'voucher'
      'WHERE'
      '  voucherid = :Old_voucherid')
    Connection = MainDM.UniConn
    SQL.Strings = (
      'select * from tfb_voucher'
      'where voucherid=:voucherid'
      'order by OrderNo')
    CachedUpdates = True
    Options.PrepareUpdateSQL = True
    Options.SetFieldsReadOnly = False
    Options.RequiredFields = False
    Options.QueryRecCount = True
    Options.UpdateAllFields = True
    Left = 32
    Top = 8
    ParamData = <
      item
        DataType = ftInteger
        Name = 'voucherid'
        ParamType = ptInput
        Value = 0
      end>
  end
  object qryVoucherDtl: TUniQuery
    SQLInsert.Strings = (
      'INSERT INTO tfb_voucherdtl'
      
        '  (voucherid, bno, borderno, deptid, moneyid, projectid, balance' +
        'id, subjectid, traderid, productid, empid, explan, dodebit, debi' +
        'tamt, creditamt, dcdebitamt, dccreditamt, exchrate, quantity, pr' +
        'ice, baldate, balbcode, unclearamt, baled, checkdate, cleared, c' +
        'learamt, create_time, costprice, substock, availamt, availqty, p' +
        'lacedate, cprice, stockamt, readonly)'
      'VALUES'
      
        '  (:voucherid, :bno, :borderno, :deptid, :moneyid, :projectid, :' +
        'balanceid, :subjectid, :traderid, :productid, :empid, :explan, :' +
        'dodebit, :debitamt, :creditamt, :dcdebitamt, :dccreditamt, :exch' +
        'rate, :quantity, :price, :baldate, :balbcode, :unclearamt, :bale' +
        'd, :checkdate, :cleared, :clearamt, :create_time, :costprice, :s' +
        'ubstock, :availamt, :availqty, :placedate, :cprice, :stockamt, :' +
        'readonly)')
    SQLDelete.Strings = (
      'DELETE FROM tfb_voucherdtl'
      'WHERE'
      '  voucherid = :Old_voucherid AND bno = :Old_bno')
    SQLUpdate.Strings = (
      'UPDATE tfb_voucherdtl'
      'SET'
      
        '  voucherid = :voucherid, bno = :bno, borderno = :borderno, dept' +
        'id = :deptid, moneyid = :moneyid, projectid = :projectid, balanc' +
        'eid = :balanceid, subjectid = :subjectid, traderid = :traderid, ' +
        'productid = :productid, empid = :empid, explan = :explan, dodebi' +
        't = :dodebit, debitamt = :debitamt, creditamt = :creditamt, dcde' +
        'bitamt = :dcdebitamt, dccreditamt = :dccreditamt, exchrate = :ex' +
        'chrate, quantity = :quantity, price = :price, baldate = :baldate' +
        ', balbcode = :balbcode, unclearamt = :unclearamt, baled = :baled' +
        ', checkdate = :checkdate, cleared = :cleared, clearamt = :cleara' +
        'mt, create_time = :create_time, costprice = :costprice, substock' +
        ' = :substock, availamt = :availamt, availqty = :availqty, placed' +
        'ate = :placedate, cprice = :cprice, stockamt = :stockamt, readon' +
        'ly = :readonly'
      'WHERE'
      '  voucherid = :Old_voucherid AND bno = :Old_bno')
    SQLLock.Strings = (
      'SELECT * FROM tfb_voucherdtl'
      'WITH (UPDLOCK, ROWLOCK, HOLDLOCK)'
      'WHERE'
      '  voucherid = :Old_voucherid AND bno = :Old_bno')
    SQLRefresh.Strings = (
      
        'SELECT voucherid, bno, borderno, deptid, moneyid, projectid, bal' +
        'anceid, subjectid, traderid, productid, empid, explan, dodebit, ' +
        'debitamt, creditamt, dcdebitamt, dccreditamt, exchrate, quantity' +
        ', price, baldate, balbcode, unclearamt, baled, checkdate, cleare' +
        'd, clearamt, create_time, costprice, substock, availamt, availqt' +
        'y, placedate, cprice, stockamt, readonly FROM tfb_voucherdtl'
      'WHERE'
      '  voucherid = :Old_voucherid AND bno = :Old_bno')
    Connection = MainDM.UniConn
    SQL.Strings = (
      'select *,debitamt+creditamt as vouamt from tfb_voucherdtl'
      'where voucherid=:voucherid')
    CachedUpdates = True
    Options.PrepareUpdateSQL = True
    Options.SetFieldsReadOnly = False
    Options.RequiredFields = False
    Options.QueryRecCount = True
    Options.UpdateAllFields = True
    Left = 24
    Top = 60
    ParamData = <
      item
        DataType = ftInteger
        Name = 'voucherid'
        ParamType = ptInput
        Value = 0
      end>
  end
  object dspVoucher: TDataSetProvider
    DataSet = qryVoucher
    UpdateMode = upWhereKeyOnly
    BeforeUpdateRecord = dspVoucherBeforeUpdateRecord
    Left = 88
    Top = 20
  end
  object dspVoucherDtl: TDataSetProvider
    DataSet = qryVoucherDtl
    UpdateMode = upWhereKeyOnly
    BeforeUpdateRecord = dspVoucherDtlBeforeUpdateRecord
    Left = 88
    Top = 72
  end
  object cdsVoucher: TClientDataSet
    Aggregates = <>
    Params = <>
    ProviderName = 'dspVoucher'
    Left = 148
    Top = 8
  end
  object cdsVoucherDtl: TClientDataSet
    Aggregates = <>
    Params = <>
    ProviderName = 'dspVoucherDtl'
    Left = 148
    Top = 56
  end
  object qrySubjectToFM: TUniQuery
    Connection = MainDM.UniConn
    SQL.Strings = (
      'Select s.SUBJECTID,s.MoneyID,m.Rate,m.calctype '
      'From tfd_SUBJECT s'
      'Left join td_Money m On s.MoneyID=m.MoneyID'
      'Where DoFMoney=1')
    CachedUpdates = True
    Options.SetFieldsReadOnly = False
    Options.RequiredFields = False
    Options.QueryRecCount = True
    Left = 28
    Top = 232
  end
  object spp_finmonthreckoning: TUniStoredProc
    StoredProcName = 'p_finmonthreckoning'
    Connection = MainDM.UniConn
    Left = 576
    Top = 192
    ParamData = <
      item
        DataType = ftInteger
        Name = 'RETURN_VALUE'
        ParamType = ptResult
        Value = 0
      end
      item
        DataType = ftInteger
        Name = 'iyear'
        ParamType = ptInput
        Value = nil
      end
      item
        DataType = ftInteger
        Name = 'imonth'
        ParamType = ptInput
        Value = nil
      end>
    CommandStoredProcName = 'p_finmonthreckoning'
  end
  object qryNextMsFixast: TUniQuery
    Connection = MainDM.UniConn
    SQL.Strings = (
      'Select * From tft_msfixedassets'
      'Where NYear=:NextYear And NMonth=:NextMonth'
      '  And (NeedFresh=0 Or (FixedAssetID In (Select FixedAssetID'
      '                                        From tfb_fixastmodify'
      
        '                                        Where YEAR(ChangeDate)=:' +
        'NextYear2'
      
        '                                          And MONTH(ChangeDate)=' +
        ':NextMonth2)))')
    CachedUpdates = True
    Options.SetFieldsReadOnly = False
    Options.RequiredFields = False
    Options.QueryRecCount = True
    Left = 360
    Top = 272
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'NextYear'
        Size = -1
        Value = nil
      end
      item
        DataType = ftUnknown
        Name = 'NextMonth'
        Size = -1
        Value = nil
      end
      item
        DataType = ftUnknown
        Name = 'NextYear2'
        Size = -1
        Value = nil
      end
      item
        DataType = ftUnknown
        Name = 'NextMonth2'
        Size = -1
        Value = nil
      end>
  end
  object dspGetNextDepr: TDataSetProvider
    DataSet = qryGetNextDepr
    UpdateMode = upWhereKeyOnly
    Left = 78
    Top = 140
  end
  object cdsGetNextDepr: TClientDataSet
    Aggregates = <>
    Params = <>
    ProviderName = 'dspGetNextDepr'
    Left = 140
    Top = 152
  end
  object qryGetNextDepr: TUniQuery
    SQLInsert.Strings = (
      'INSERT INTO tfb_fixedassets'
      
        '  (fixedassetid, filid, fadeltypeid, newtypeid, statusid, fatype' +
        'id, deprmethodid, addvoucherid, delvoucherid, cardcode, assetcod' +
        'e, name, specific, location, useddate, planusemonth, sumusedmont' +
        'h, startsumusedmonth, planworkvalue, sumworkedvalue, startsumwor' +
        'kedvalue, workunit, rawamt, sumdepramt, startsumdepramt, remaina' +
        'mt, remainrate, monthdepramt, monthdeprrate, deproption, clearda' +
        'te, clearincome, clearpay, clearmemo, cleared, addr, vendorname,' +
        ' producename, initflag, startrawamt, astsubid, dprsubid, clearsu' +
        'bid, price, quantity, foreignamt, foreigncurid, unit, custom1, c' +
        'ustom2, custom3, custom4, custom5, pic, pictype, incomesubid, in' +
        'comeaccountid, paysubid, payaccountid, taxsubid, taxamount)'
      'VALUES'
      
        '  (:fixedassetid, :filid, :fadeltypeid, :newtypeid, :statusid, :' +
        'fatypeid, :deprmethodid, :addvoucherid, :delvoucherid, :cardcode' +
        ', :assetcode, :name, :specific, :location, :useddate, :planusemo' +
        'nth, :sumusedmonth, :startsumusedmonth, :planworkvalue, :sumwork' +
        'edvalue, :startsumworkedvalue, :workunit, :rawamt, :sumdepramt, ' +
        ':startsumdepramt, :remainamt, :remainrate, :monthdepramt, :month' +
        'deprrate, :deproption, :cleardate, :clearincome, :clearpay, :cle' +
        'armemo, :cleared, :addr, :vendorname, :producename, :initflag, :' +
        'startrawamt, :astsubid, :dprsubid, :clearsubid, :price, :quantit' +
        'y, :foreignamt, :foreigncurid, :unit, :custom1, :custom2, :custo' +
        'm3, :custom4, :custom5, :pic, :pictype, :incomesubid, :incomeacc' +
        'ountid, :paysubid, :payaccountid, :taxsubid, :taxamount)')
    SQLDelete.Strings = (
      'DELETE FROM tfb_fixedassets'
      'WHERE'
      '  fixedassetid = :Old_fixedassetid')
    SQLUpdate.Strings = (
      'UPDATE tfb_fixedassets'
      'SET'
      
        '  fixedassetid = :fixedassetid, filid = :filid, fadeltypeid = :f' +
        'adeltypeid, newtypeid = :newtypeid, statusid = :statusid, fatype' +
        'id = :fatypeid, deprmethodid = :deprmethodid, addvoucherid = :ad' +
        'dvoucherid, delvoucherid = :delvoucherid, cardcode = :cardcode, ' +
        'assetcode = :assetcode, name = :name, specific = :specific, loca' +
        'tion = :location, useddate = :useddate, planusemonth = :planusem' +
        'onth, sumusedmonth = :sumusedmonth, startsumusedmonth = :startsu' +
        'musedmonth, planworkvalue = :planworkvalue, sumworkedvalue = :su' +
        'mworkedvalue, startsumworkedvalue = :startsumworkedvalue, workun' +
        'it = :workunit, rawamt = :rawamt, sumdepramt = :sumdepramt, star' +
        'tsumdepramt = :startsumdepramt, remainamt = :remainamt, remainra' +
        'te = :remainrate, monthdepramt = :monthdepramt, monthdeprrate = ' +
        ':monthdeprrate, deproption = :deproption, cleardate = :cleardate' +
        ', clearincome = :clearincome, clearpay = :clearpay, clearmemo = ' +
        ':clearmemo, cleared = :cleared, addr = :addr, vendorname = :vend' +
        'orname, producename = :producename, initflag = :initflag, startr' +
        'awamt = :startrawamt, astsubid = :astsubid, dprsubid = :dprsubid' +
        ', clearsubid = :clearsubid, price = :price, quantity = :quantity' +
        ', foreignamt = :foreignamt, foreigncurid = :foreigncurid, unit =' +
        ' :unit, custom1 = :custom1, custom2 = :custom2, custom3 = :custo' +
        'm3, custom4 = :custom4, custom5 = :custom5, pic = :pic, pictype ' +
        '= :pictype, incomesubid = :incomesubid, incomeaccountid = :incom' +
        'eaccountid, paysubid = :paysubid, payaccountid = :payaccountid, ' +
        'taxsubid = :taxsubid, taxamount = :taxamount'
      'WHERE'
      '  fixedassetid = :Old_fixedassetid')
    SQLLock.Strings = (
      'SELECT * FROM tfb_fixedassets'
      'WITH (UPDLOCK, ROWLOCK, HOLDLOCK)'
      'WHERE'
      '  fixedassetid = :Old_fixedassetid')
    SQLRefresh.Strings = (
      
        'SELECT fixedassetid, filid, fadeltypeid, newtypeid, statusid, fa' +
        'typeid, deprmethodid, addvoucherid, delvoucherid, cardcode, asse' +
        'tcode, name, specific, location, useddate, planusemonth, sumused' +
        'month, startsumusedmonth, planworkvalue, sumworkedvalue, startsu' +
        'mworkedvalue, workunit, rawamt, sumdepramt, startsumdepramt, rem' +
        'ainamt, remainrate, monthdepramt, monthdeprrate, deproption, cle' +
        'ardate, clearincome, clearpay, clearmemo, cleared, addr, vendorn' +
        'ame, producename, initflag, startrawamt, astsubid, dprsubid, cle' +
        'arsubid, price, quantity, foreignamt, foreigncurid, unit, custom' +
        '1, custom2, custom3, custom4, custom5, pic, pictype, incomesubid' +
        ', incomeaccountid, paysubid, payaccountid, taxsubid, taxamount F' +
        'ROM tfb_fixedassets'
      'WHERE'
      '  fixedassetid = :Old_fixedassetid')
    Connection = MainDM.UniConn
    SQL.Strings = (
      'Select * From tfb_fixedassets')
    CachedUpdates = True
    Options.SetFieldsReadOnly = False
    Options.RequiredFields = False
    Options.QueryRecCount = True
    Left = 24
    Top = 152
  end
  object qryTmp: TUniQuery
    Connection = MainDM.UniConn
    CachedUpdates = True
    Options.SetFieldsReadOnly = False
    Options.RequiredFields = False
    Options.QueryRecCount = True
    Left = 228
    Top = 272
  end
  object spp_finunmonthreckoning: TUniStoredProc
    StoredProcName = 'p_finunmonthreckoning'
    Connection = MainDM.UniConn
    Left = 568
    Top = 140
    ParamData = <
      item
        DataType = ftInteger
        Name = 'RETURN_VALUE'
        ParamType = ptResult
        Value = 0
      end
      item
        DataType = ftInteger
        Name = 'iprioryear'
        ParamType = ptInput
        Value = nil
      end
      item
        DataType = ftInteger
        Name = 'ipriormonth'
        ParamType = ptInput
        Value = nil
      end
      item
        DataType = ftInteger
        Name = 'icurryear'
        ParamType = ptInput
        Value = nil
      end
      item
        DataType = ftInteger
        Name = 'icurrmonth'
        ParamType = ptInput
        Value = nil
      end
      item
        DataType = ftInteger
        Name = 'ifilid'
        ParamType = ptInput
        Value = nil
      end>
    CommandStoredProcName = 'p_finunmonthreckoning'
  end
  object spp_finastsummary: TUniStoredProc
    StoredProcName = 'p_finastsummary'
    Connection = MainDM.UniConn
    Left = 564
    Top = 76
    ParamData = <
      item
        DataType = ftInteger
        Name = 'RETURN_VALUE'
        ParamType = ptResult
        Value = 0
      end
      item
        DataType = ftInteger
        Name = 'iyear'
        ParamType = ptInput
        Value = nil
      end
      item
        DataType = ftInteger
        Name = 'imonth'
        ParamType = ptInput
        Value = nil
      end
      item
        DataType = ftInteger
        Name = 'ihasdepr'
        ParamType = ptInput
        Value = nil
      end
      item
        DataType = ftInteger
        Name = 'ifilid'
        ParamType = ptInput
        Size = 597696942
        Value = nil
      end>
    CommandStoredProcName = 'p_finastsummary'
  end
  object spp_finastundepreciate: TUniStoredProc
    StoredProcName = 'p_finastundepreciate'
    Connection = MainDM.UniConn
    Left = 568
    Top = 24
    ParamData = <
      item
        DataType = ftInteger
        Name = 'RETURN_VALUE'
        ParamType = ptResult
        Value = -6
      end
      item
        DataType = ftInteger
        Name = 'icurryear'
        ParamType = ptInput
        Value = nil
      end
      item
        DataType = ftInteger
        Name = 'icurrmonth'
        ParamType = ptInput
        Value = nil
      end
      item
        DataType = ftInteger
        Name = 'ifilid'
        ParamType = ptInput
        Value = nil
      end>
    CommandStoredProcName = 'p_finastundepreciate'
  end
  object qryMonthly: TUniQuery
    Connection = MainDM.UniConn
    SQL.Strings = (
      
        'select bdate,edate from tfd_monthlycalendar where yearid=:yearid' +
        ' and monthid=:monthid')
    CachedUpdates = True
    Options.SetFieldsReadOnly = False
    Options.RequiredFields = False
    Options.QueryRecCount = True
    Left = 292
    Top = 272
    ParamData = <
      item
        DataType = ftInteger
        Name = 'yearid'
        Size = 4
        Value = nil
      end
      item
        DataType = ftWord
        Name = 'monthid'
        Size = 1
        Value = nil
      end>
  end
  object qryFiliale: TUniQuery
    Connection = MainDM.UniConn
    SQL.Strings = (
      'select * from td_filiale')
    CachedUpdates = True
    Options.SetFieldsReadOnly = False
    Options.RequiredFields = False
    Options.QueryRecCount = True
    Left = 96
    Top = 276
  end
  object spp_fingetnewvouinfo: TUniStoredProc
    StoredProcName = 'p_fingetnewvouinfo'
    Connection = MainDM.UniConn
    Left = 572
    Top = 252
    ParamData = <
      item
        DataType = ftInteger
        Name = 'RETURN_VALUE'
        ParamType = ptResult
        Value = 0
      end
      item
        DataType = ftInteger
        Name = 'voucherid'
        ParamType = ptInput
        Value = nil
      end
      item
        DataType = ftInteger
        Name = 'formertype'
        ParamType = ptInput
        Value = nil
      end
      item
        DataType = ftInteger
        Name = 'formerbid'
        ParamType = ptInput
        Value = nil
      end
      item
        DataType = ftInteger
        Name = 'vouwordid'
        ParamType = ptInput
        Value = nil
      end
      item
        DataType = ftDateTime
        Name = 'bdate'
        ParamType = ptInput
        Value = nil
      end
      item
        DataType = ftInteger
        Name = 'filid'
        ParamType = ptInput
        Value = nil
      end
      item
        DataType = ftInteger
        Name = 'orderno'
        ParamType = ptInputOutput
        Value = nil
      end
      item
        DataType = ftInteger
        Name = 'voucherno'
        ParamType = ptInputOutput
        Value = nil
      end
      item
        DataType = ftInteger
        Name = 'filorderno'
        ParamType = ptInputOutput
        Value = nil
      end
      item
        DataType = ftInteger
        Name = 'newvoucherid'
        ParamType = ptInputOutput
        Value = nil
      end
      item
        DataType = ftString
        Name = 'yearmonth'
        ParamType = ptInputOutput
        Size = 6
        Value = nil
      end
      item
        DataType = ftString
        Name = 'bcode'
        ParamType = ptInputOutput
        Size = 40
        Value = nil
      end>
    CommandStoredProcName = 'p_fingetnewvouinfo'
  end
  object dsTemp: TDataSource
    Left = 392
    Top = 104
  end
  object qryTemp: TUniQuery
    Connection = MainDM.UniConn
    CachedUpdates = True
    Options.PrepareUpdateSQL = True
    Options.SetFieldsReadOnly = False
    Options.RequiredFields = False
    Options.QueryRecCount = True
    Options.AutoPrepare = True
    Left = 336
    Top = 96
  end
  object qryUpdate: TUniQuery
    Connection = MainDM.UniConn
    Options.PrepareUpdateSQL = True
    Left = 216
    Top = 29
  end
end
